IIS Apache creates strange character

IIS Apache creates strange character

am 06.12.2007 02:15:00 von Carpadum

We have an application that is developed by an outside vendor that is running
on Apache. In order for us to brand the site with our logo we put a link to
an html file in the configuration of the apache app. The apache app displays
a web page that includes the apache data and the html code served from the
IIS server that we have that contains the logo. When we do this a strange
ascii looking charcter appears above our graphic.  We have loaded the
same graphic on the vendors unix box and it does not occur. Basically it is
a simple html file that contains the following code.


height="268">


so when the page is displayed that code is inserted in the middle of the
"complete" html for the page. If I go to
http://servernamereplacedhere.com/main-guest3.jpg directly it does not show
the characters so it is something that apache does not like that IIS is
sending.
I have tried removing asp.net from this instance of IIS, content expiration
on/off, and pretty much every other setting in the site instance.
Any ideas?

Re: IIS Apache creates strange character

am 06.12.2007 05:47:03 von David Wang

On Dec 5, 5:15 pm, Carpadum
wrote:
> We have an application that is developed by an outside vendor that is runn=
ing
> on Apache. In order for us to brand the site with our logo we put a link =
to
> an html file in the configuration of the apache app. The apache app displ=
ays
> a web page that includes the apache data and the html code served from the=

> IIS server that we have that contains the logo. When we do this a strange=

> ascii looking charcter appears above our graphic. =EF>>=BF We have loade=
d the
> same graphic on the vendors unix box and it does not occur. Basically it =
is
> a simple html file that contains the following code.
>
>
> 0"
> height=3D"268">
>
>
> so when the page is displayed that code is inserted in the middle of the
> "complete" html for the page. If I go tohttp://servernamereplacedhere.com=
/main-guest3.jpgdirectly it does not show
> the characters so it is something that apache does not like that IIS is
> sending.
> I have tried removing asp.net from this instance of IIS, content expiratio=
n
> on/off, and pretty much every other setting in the site instance.
> Any ideas?


That looks like the UTF8 BOM marker. Check if the "simple html file"
is encoded in ASCII or UTF8.

If the file is encoded in UTF8, then the problem is that you failed to
properly configure IIS to send the correct Content-Type and Content-
Encoding for your special file such that another application like the
Apache app to properly decode it.

IIS comes with a lot of standard content-type encodings, matched by
resource extension, which magically makes a lot of files work, so most
server administrators do not realize that it is actually *their*
responsibility to ensure that the correct content-type goes along with
their resource.

You fix this by making the file content match its Content-Type. This
means either:
1. Set the MIME Type for the file resource's extension
2. Save the HTML file to ASCII since it doesn't need to be UTF8

I suspect #2 is easier to do than #1.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: IIS Apache creates strange character

am 06.12.2007 05:50:29 von Ken Schaefer

Hi,

If the HTML page served from the Apache server contains the HTML code you
have below, then Apache is not making any requests to IIS.

Instead, Apache is sending the HTML file to the browser. And the browser
parses the HTML file and finds the tag, and makes a completely
separate request to IIS for the image file.

Now, if IIS is not returning the funny character, then the funny character
is probably being sent by Apache or similar.

As a test - update the HTML file so that it points to a non-existant image
file. That way, IIS will just return a 404 error (assuming you don't have
any fancy custom error pages setup). What do you see then?

Cheers
Ken

--
My IIS Blog: www.adOpenStatic.com/cs/blogs/ken

"Carpadum" wrote in message
news:8B8441AB-DC6F-491C-8387-DA45CE6E04DA@microsoft.com...
> We have an application that is developed by an outside vendor that is
> running
> on Apache. In order for us to brand the site with our logo we put a link
> to
> an html file in the configuration of the apache app. The apache app
> displays
> a web page that includes the apache data and the html code served from the
> IIS server that we have that contains the logo. When we do this a strange
> ascii looking charcter appears above our graphic.  We have loaded the
> same graphic on the vendors unix box and it does not occur. Basically it
> is
> a simple html file that contains the following code.
>
>
> > height="268">
>
>
> so when the page is displayed that code is inserted in the middle of the
> "complete" html for the page. If I go to
> http://servernamereplacedhere.com/main-guest3.jpg directly it does not
> show
> the characters so it is something that apache does not like that IIS is
> sending.
> I have tried removing asp.net from this instance of IIS, content
> expiration
> on/off, and pretty much every other setting in the site instance.
> Any ideas?

Re: IIS Apache creates strange character

am 06.12.2007 10:08:13 von Anthony Jones

"David Wang" wrote in message
news:68c7873c-bd28-4644-95ef-d7ddb2c1ff39@s36g2000prg.google groups.com...
On Dec 5, 5:15 pm, Carpadum
wrote:

>
>1. Set the MIME Type for the file resource's extension
>

David,

Given a HTM file saved as UTF-8 how do you go about ensuring that the
correct charset is sent in the content-type header?

As far as I can see the only way to do it is modify the mime map on the file
itself so that the content-type header sent includes the charset.

It would be better I think if one could set the charset for a file as a
separate property rather than mucking about with the mimemap property.


--
Anthony Jones - MVP ASP/ASP.NET

Re: IIS Apache creates strange character

am 06.12.2007 10:30:22 von Andrew Morton

Anthony Jones wrote:
> Given a HTM file saved as UTF-8 how do you go about ensuring that the
> correct charset is sent in the content-type header?
>
> As far as I can see the only way to do it is modify the mime map on
> the file itself so that the content-type header sent includes the
> charset.
>
> It would be better I think if one could set the charset for a file as
> a separate property rather than mucking about with the mimemap
> property.

Why not just use


in the section? Correct markup in the OP's file might also have
helped the browser.

Andrew

Re: IIS Apache creates strange character

am 06.12.2007 12:21:40 von David Wang

On Dec 6, 1:08 am, "Anthony Jones" wrote:
> "David Wang" wrote in message
>
> news:68c7873c-bd28-4644-95ef-d7ddb2c1ff39@s36g2000prg.google groups.com...
> On Dec 5, 5:15 pm, Carpadum
> wrote:
>
>
>
>
> >1. Set the MIME Type for the file resource's extension
>
> David,
>
> Given a HTM file saved as UTF-8 how do you go about ensuring that the
> correct charset is sent in the content-type header?
>
> As far as I can see the only way to do it is modify the mime map on the file
> itself so that the content-type header sent includes the charset.
>
> It would be better I think if one could set the charset for a file as a
> separate property rather than mucking about with the mimemap property.
>
> --
> Anthony Jones - MVP ASP/ASP.NET


It has always been the user's responsibility to associate the correct
MIME Type with the resource. Unfortunately, many people author and
serve web pages without any idea about something as fundamental as
content encoding, until ?? or other junk characters materialize when
content is mischaracterized between UTF8, Unicode, DBCS, ANSI . I
mean, how is a web browser supposed to figure out how to properly
display something, and how is a web server supposed to know what data
type is being served? People see that it "just works" most of the time
and assumes that the "system" takes care of them, but that is simply
incorrect.

IIS6/7 tries to make Webmasters learn this responsibility (in addition
to good security practice) by making the Static File Handler serve
only known extensions.

IIS provides these mechanisms to help users fulfill their
responsibility:
1. Registry + Metabase defaults for common resource extensions
2. Per URL configuration of MIME Type

Andrew mentions how users can help themselves.

In this case, what the Apache App does illustrates that even something
as simple as "including data for branding purposes" is not as easy as
it seems. The included data is parsed by the browser as HTML, which
means that it has to be in the same encoding. If the content are not
in the same or compatible encodings, then extra junk characters can
materialize.

I'm pretty certain the OP thinks this is a problem with IIS or
incompatibility between IIS/Apache when it is probably just user
misconfiguration.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: IIS Apache creates strange character

am 06.12.2007 14:25:31 von Anthony Jones

"David Wang" wrote in message
news:687d9345-4f31-4ed9-9458-5516a9bf5862@e25g2000prg.google groups.com...
> On Dec 6, 1:08 am, "Anthony Jones" wrote:
> > "David Wang" wrote in message
> >
> >
news:68c7873c-bd28-4644-95ef-d7ddb2c1ff39@s36g2000prg.google groups.com...
> > On Dec 5, 5:15 pm, Carpadum
> > wrote:
> >
> >
> >
> >
> > >1. Set the MIME Type for the file resource's extension
> >
> > David,
> >
> > Given a HTM file saved as UTF-8 how do you go about ensuring that the
> > correct charset is sent in the content-type header?
> >
> > As far as I can see the only way to do it is modify the mime map on the
file
> > itself so that the content-type header sent includes the charset.
> >
> > It would be better I think if one could set the charset for a file as a
> > separate property rather than mucking about with the mimemap property.
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET
>
>
> It has always been the user's responsibility to associate the correct
> MIME Type with the resource. Unfortunately, many people author and
> serve web pages without any idea about something as fundamental as
> content encoding, until ?? or other junk characters materialize when
> content is mischaracterized between UTF8, Unicode, DBCS, ANSI . I
> mean, how is a web browser supposed to figure out how to properly
> display something, and how is a web server supposed to know what data
> type is being served? People see that it "just works" most of the time
> and assumes that the "system" takes care of them, but that is simply
> incorrect.
>

I agree but MS has gone quite some way to making things just work despite
'People' being naughty. IIS at server level comes out of the box with
quite a significant mime-map yet none of them carry a charset value, which
is understandable. However strictly speaking a text mime type is
incomplete with out a charset. It is the site owners responsibility then to
ensure by one means or another that the content-type header is complete.

Unfortunately most 'People' think of the mime type separately from the
charset. It isn't obvious how to handle this in IIS management. It doesn't
help that looking that the MS provided mimemap (which being from MS must be
correct right?) has text mime types which aren't actually correct. Since
they aren't correct it might be better that they also were missing
altogether along with the .* mapping.

Internet Explorer hasn't helped the situation with its content sniffing and
codepage/charset assumptions which helped make things just work despite
improper/missing headers.

> IIS6/7 tries to make Webmasters learn this responsibility (in addition
> to good security practice) by making the Static File Handler serve
> only known extensions.
>
> IIS provides these mechanisms to help users fulfill their
> responsibility:
> 1. Registry + Metabase defaults for common resource extensions

That would include setting the charset that is typically used for each type
of file. Where in the IIS installation/setup documentation is this
rersponsibility laid out?

> 2. Per URL configuration of MIME Type

It would be nice to open the properies window on a file and say 'oh but this
one is UTF-8'. Or better yet just enter a Content-Type header and have IIS
intelligent enough not to add its own when sending. Instead we have to open
the a mimemap enter the files extension (why should we have to do that, the
resource only has one extension) and enter the mime type with charset.

Don't get me wrong I'm not having a major whinge or claiming that the
responsibility isn't in the 'Peoples' court, IIS can't be held responsible
if output is misinterpreted because the person responsible didn't configure
it correctly.

However, re-using an analogy from another thread, if I were to keep tidying
up my kids bedrooms for them would they learn to take that responsibility
for themselves?
So to, with MS quitely tidying up loose ends that should've been 'Peoples'
responsibilty its not too surprising that 'People' aren't aware of they're
responsibility.

--
Anthony Jones - MVP ASP/ASP.NET

Re: IIS Apache creates strange character

am 06.12.2007 14:27:25 von Anthony Jones

"Andrew Morton" wrote in message
news:um4$jq%23NIHA.5140@TK2MSFTNGP05.phx.gbl...
> Anthony Jones wrote:
> > Given a HTM file saved as UTF-8 how do you go about ensuring that the
> > correct charset is sent in the content-type header?
> >
> > As far as I can see the only way to do it is modify the mime map on
> > the file itself so that the content-type header sent includes the
> > charset.
> >
> > It would be better I think if one could set the charset for a file as
> > a separate property rather than mucking about with the mimemap
> > property.
>
> Why not just use
>
>
> in the section? Correct markup in the OP's file might also have
> helped the browser.
>

That works in the specific case where HTML content is being rendered by a
browser. However I had in mind the more general case of text oriented
content.

--
Anthony Jones - MVP ASP/ASP.NET

Re: IIS Apache creates strange character

am 06.12.2007 15:38:19 von Carpadum

That does not appear to be the case. When I replace with an image file that
does not exist it simply puts a red x on the page where the image should be.
Good idea though.



"Ken Schaefer" wrote:

> Hi,
>
> If the HTML page served from the Apache server contains the HTML code you
> have below, then Apache is not making any requests to IIS.
>
> Instead, Apache is sending the HTML file to the browser. And the browser
> parses the HTML file and finds the tag, and makes a completely
> separate request to IIS for the image file.
>
> Now, if IIS is not returning the funny character, then the funny character
> is probably being sent by Apache or similar.
>
> As a test - update the HTML file so that it points to a non-existant image
> file. That way, IIS will just return a 404 error (assuming you don't have
> any fancy custom error pages setup). What do you see then?
>
> Cheers
> Ken
>
> --
> My IIS Blog: www.adOpenStatic.com/cs/blogs/ken
>
> "Carpadum" wrote in message
> news:8B8441AB-DC6F-491C-8387-DA45CE6E04DA@microsoft.com...
> > We have an application that is developed by an outside vendor that is
> > running
> > on Apache. In order for us to brand the site with our logo we put a link
> > to
> > an html file in the configuration of the apache app. The apache app
> > displays
> > a web page that includes the apache data and the html code served from the
> > IIS server that we have that contains the logo. When we do this a strange
> > ascii looking charcter appears above our graphic.  We have loaded the
> > same graphic on the vendors unix box and it does not occur. Basically it
> > is
> > a simple html file that contains the following code.
> >
> >
> > > > height="268">
> >
> >
> > so when the page is displayed that code is inserted in the middle of the
> > "complete" html for the page. If I go to
> > http://servernamereplacedhere.com/main-guest3.jpg directly it does not
> > show
> > the characters so it is something that apache does not like that IIS is
> > sending.
> > I have tried removing asp.net from this instance of IIS, content
> > expiration
> > on/off, and pretty much every other setting in the site instance.
> > Any ideas?
>
>

Re: IIS Apache creates strange character

am 06.12.2007 15:45:01 von Carpadum

David,

Thanks for the info. I understand that I should know more about IIS,
however it is typically our developers that request special settings in IIS.
The vendor that I am working with does not seem to have a clue nor can they
tell me anything about what type of encoding the apache server is doing so I
am kinda working in the dark here. I know nothing about apache so are you
saying that I need to setup IIS to format the file as UTF8. You gave me two
things to try....
> 1. Set the MIME Type for the file resource's extension
> 2. Save the HTML file to ASCII since it doesn't need to be UTF8
If I set the MIME Type then what do I set it too?

Thanks for your help. This is the first time I have ever run into issues
with MIME

"David Wang" wrote:

> On Dec 5, 5:15 pm, Carpadum
> wrote:
> > We have an application that is developed by an outside vendor that is running
> > on Apache. In order for us to brand the site with our logo we put a link to
> > an html file in the configuration of the apache app. The apache app displays
> > a web page that includes the apache data and the html code served from the
> > IIS server that we have that contains the logo. When we do this a strange
> > ascii looking charcter appears above our graphic. ï>>¿ We have loaded the
> > same graphic on the vendors unix box and it does not occur. Basically it is
> > a simple html file that contains the following code.
> >
> >
> > > > height="268">
> >
> >
> > so when the page is displayed that code is inserted in the middle of the
> > "complete" html for the page. If I go tohttp://servernamereplacedhere.com/main-guest3.jpgdirectly it does not show
> > the characters so it is something that apache does not like that IIS is
> > sending.
> > I have tried removing asp.net from this instance of IIS, content expiration
> > on/off, and pretty much every other setting in the site instance.
> > Any ideas?
>
>
> That looks like the UTF8 BOM marker. Check if the "simple html file"
> is encoded in ASCII or UTF8.
>
> If the file is encoded in UTF8, then the problem is that you failed to
> properly configure IIS to send the correct Content-Type and Content-
> Encoding for your special file such that another application like the
> Apache app to properly decode it.
>
> IIS comes with a lot of standard content-type encodings, matched by
> resource extension, which magically makes a lot of files work, so most
> server administrators do not realize that it is actually *their*
> responsibility to ensure that the correct content-type goes along with
> their resource.
>
> You fix this by making the file content match its Content-Type. This
> means either:
> 1. Set the MIME Type for the file resource's extension
> 2. Save the HTML file to ASCII since it doesn't need to be UTF8
>
> I suspect #2 is easier to do than #1.
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>

Re: IIS Apache creates strange character

am 06.12.2007 23:57:44 von David Wang

On Dec 6, 5:25 am, "Anthony Jones" wrote:
> "David Wang" wrote in message
>
> news:687d9345-4f31-4ed9-9458-5516a9bf5862@e25g2000prg.google groups.com...> On Dec 6, 1:08 am, "Anthony Jones" wrote:
> > > "David Wang" wrote in message
>
> news:68c7873c-bd28-4644-95ef-d7ddb2c1ff39@s36g2000prg.google groups.com...
>
>
>
>
>
> > > On Dec 5, 5:15 pm, Carpadum
> > > wrote:
> > >
>
> > > >1. Set the MIME Type for the file resource's extension
>
> > > David,
>
> > > Given a HTM file saved as UTF-8 how do you go about ensuring that the
> > > correct charset is sent in the content-type header?
>
> > > As far as I can see the only way to do it is modify the mime map on the
> file
> > > itself so that the content-type header sent includes the charset.
>
> > > It would be better I think if one could set the charset for a file as a
> > > separate property rather than mucking about with the mimemap property.
>
> > > --
> > > Anthony Jones - MVP ASP/ASP.NET
>
> > It has always been the user's responsibility to associate the correct
> > MIME Type with the resource. Unfortunately, many people author and
> > serve web pages without any idea about something as fundamental as
> > content encoding, until ?? or other junk characters materialize when
> > content is mischaracterized between UTF8, Unicode, DBCS, ANSI . I
> > mean, how is a web browser supposed to figure out how to properly
> > display something, and how is a web server supposed to know what data
> > type is being served? People see that it "just works" most of the time
> > and assumes that the "system" takes care of them, but that is simply
> > incorrect.
>
> I agree but MS has gone quite some way to making things just work despite
> 'People' being naughty. IIS at server level comes out of the box with
> quite a significant mime-map yet none of them carry a charset value, which
> is understandable. However strictly speaking a text mime type is
> incomplete with out a charset. It is the site owners responsibility then to
> ensure by one means or another that the content-type header is complete.
>
> Unfortunately most 'People' think of the mime type separately from the
> charset. It isn't obvious how to handle this in IIS management. It doesn't
> help that looking that the MS provided mimemap (which being from MS must be
> correct right?) has text mime types which aren't actually correct. Since
> they aren't correct it might be better that they also were missing
> altogether along with the .* mapping.
>
> Internet Explorer hasn't helped the situation with its content sniffing and
> codepage/charset assumptions which helped make things just work despite
> improper/missing headers.
>
> > IIS6/7 tries to make Webmasters learn this responsibility (in addition
> > to good security practice) by making the Static File Handler serve
> > only known extensions.
>
> > IIS provides these mechanisms to help users fulfill their
> > responsibility:
> > 1. Registry + Metabase defaults for common resource extensions
>
> That would include setting the charset that is typically used for each type
> of file. Where in the IIS installation/setup documentation is this
> rersponsibility laid out?
>
> > 2. Per URL configuration of MIME Type
>
> It would be nice to open the properies window on a file and say 'oh but this
> one is UTF-8'. Or better yet just enter a Content-Type header and have IIS
> intelligent enough not to add its own when sending. Instead we have to open
> the a mimemap enter the files extension (why should we have to do that, the
> resource only has one extension) and enter the mime type with charset.
>
> Don't get me wrong I'm not having a major whinge or claiming that the
> responsibility isn't in the 'Peoples' court, IIS can't be held responsible
> if output is misinterpreted because the person responsible didn't configure
> it correctly.
>
> However, re-using an analogy from another thread, if I were to keep tidying
> up my kids bedrooms for them would they learn to take that responsibility
> for themselves?
> So to, with MS quitely tidying up loose ends that should've been 'Peoples'
> responsibilty its not too surprising that 'People' aren't aware of they're
> responsibility.
>
> --
> Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>
> - Show quoted text -


I agree with your sentiments. As long as the web server keeps sending
mostly correct Content-Types and the web browser keeps sniffing and
guessing, there is very little incentive for the WebMaster to do the
right thing. Unfortunately, like the Netscape/IE wars, neither client
nor server will take a hard-line on this issue because to do otherwise
will simply appear as if "you're broken but your competition isn't".

But hey, it gives folks like us something to rant about. ;-)

I mean, I don't think it is Microsoft or anyone's responsibility to
lay out in documentation the do's and don'ts of WebMastering. Using
your analogy -- anyone can have a child, but where's the manual on how
to rear children?


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: IIS Apache creates strange character

am 07.12.2007 10:42:47 von Andrew Morton

David Wang wrote:
> I mean, I don't think it is Microsoft or anyone's responsibility to
> lay out in documentation the do's and don'ts of WebMastering. Using
> your analogy -- anyone can have a child, but where's the manual on how
> to rear children?

"The Baby Owner's Manual: Operating Instructions, Trouble-shooting Tips and
Advice on First-year Maintenance"
http://www.amazon.co.uk/Baby-Owners-Manual-Instructions-Trou ble-shooting/dp/1931686238/ref=sr_1_2?ie=UTF8&s=books&qid=11 97020312&sr=1-2

SCNR :-)

Andrew